<?php
FLEA::loadClass('Api_RequestZhitu');
class Api_Lib_Req_Zhitu_ImageSim extends Api_RequestZhitu{

    function __construct() {
        parent::__construct();

        $this->_modelExample = FLEA::getSingleton('Model_Jichu_Image');

        //公司编号
        FLEA::loadClass('TMIS_Common');
        $ctlDefault = FLEA::getSingleton('TMIS_Controller');
        $this->compCode = TMIS_Common::getCompCode();
        $this->compName = $ctlDefault->getCompName();

        $this->catid = '10';
    }

    // 上传图片
    function addImage($param = array()){
        $param['apisim_search'] = 'apisim_additem';
        // $param['kwds'] = $param['kwds'] ? $param['kwds'] : array();
        $param['kwds'][]        = $this->compCode;
        $param['kwds']          = join(',' ,$param['kwds']);
        $param['subject']       = $param['kwds'];
        $param['labels']        = $param['imageId'];
        $param['title']         = $this->compName;
        $param['catid']         = $this->catid;
        $param['imgname']       = $this->compCode.'_'.$param['imageId'];
        $param['info']          = $this->compCode.'_'.$param['imageId'];
        $param['photo']         = '@'.($param['smallPath'] ? $param['smallPath'] : $param['path']);
        // dump($param);exit;
        $response = $this->api_caller($param);
        return $response ;
    }

    //删除图片
    function deleteImage($param = array()){
        $param['apisim_search'] = 'apisim_deleteitem';
        $param['imgname']       = $this->compCode.'_'.$param['imageId'];

        $response = $this->api_caller($param);
        return $response ;
    }

    //搜索图片
    function searchImage($param = array()){
        $param['apisim_search'] = 'apisim_search';
        $param['catid']         = $this->catid;
        $param['subject']       = $this->compCode;
        $param['p']             = $param['page'] ? $param['page'] : 1;
        $param['numperpage']    = $param['numperpage'] ? $param['numperpage'] : 60;
        $param['maxitems']      = $param['maxitems'] ? $param['maxitems'] : 200;
        $param['photo']         = '@'.$param['path'];

        $response = $this->api_caller($param);
        return $response ;
    }


    //查询图片详情
    function detailImage($param = array()){
        $param['apisim_search'] = 'apisim_detail';
        $param['imgname']       = $this->compCode.'_'.$param['imageId'];

        $response = $this->api_caller($param);
        return $response ;
    }

    //浏览图片
    function browseImage($param = array()){
        $param['apisim_search'] = 'apipnp_browse';
        $param['catid']         = $this->catid;
        $param['subject']       = $this->compCode;
        $param['p']             = $param['page'] ? $param['page'] : 1;
        $param['numperpage']    = $param['numperpage'] ? $param['numperpage'] : 50;
        $param['maxitems']      = $param['maxitems'] ? $param['maxitems'] : 200;
        // dump($param);exit;
        $response = $this->api_caller($param);
        return $response ;
    }

}

?>